
using System.Linq;
using System.Web.Mvc;
using Ezio.Models;

namespace Ezio.Controllers
{
    public class CompromisosController : Controller
    {
        DataProvider Provider = new DataProvider();
        
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Agregar(Compromisos Compromiso)
        {
            Provider.AddToCompromisos(Compromiso);
            return RedirectToAction("Index", new { Success = Provider.TrySaveChanges() });
        }

        public ActionResult Index()
        {
            ViewData["Compromisos"] = Provider.ItemsCompromisos.Where(t => t.Compromisos.Colegios.Username == HttpContext.User.Identity.Name).ToList();
            return View("Index");
        }
    }
}
